import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

public class Demo9 {

    public static void main(String[] args) {
        try(Writer writer = new FileWriter("./demo")) {
            char[] chars = new char[]{'你','好'};

            writer.write(chars);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static void main3(String[] args) {
        try(Writer writer = new FileWriter("./demo")) {
            String string = "你好";
            char[] b = new char[10];
            string.getChars(0,string.length() - 1,b,0);

            //char[] b = new char[]{'a','b','c'};
            writer.write(b);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static void main2(String[] args) {
        try (Writer writer = new FileWriter("./demo")) {
            String b = "你好";
            writer.write(b);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static void main1(String[] args) {
        try (Writer writer = new FileWriter("./demo")){
            writer.write(97);
            writer.write(98);
            writer.write(99);
            writer.write(100);

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
